<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>SUOYUEの图片管理</title>

  <link rel="shortcut icon" th:href="@{/images/favicon.ico}" />
  <link rel="stylesheet" href="../../static/lib/Semantic-UI/semantic.min.css" th:href="@{/lib/Semantic-UI/semantic.min.css}">
  <link rel="stylesheet" href="../../static/css/me.css" th:href="@{/css/me.css}">
</head>
<body>

  <!--导航栏-->
  <nav class="ui inverted gird-header" >
    <div class="ui container">
      <div class="ui inverted secondary stackable menu">
        <h2 class="ui olive header item" style="font-family: STSong">SUOYUEの管理后台</h2>
        <a href="#" th:href="@{/admin/blogs}" class="m-item item m-mobile-hide"><i class="home icon"></i>文章管理</a>
        <a href="#" th:href="@{/admin/types}" class="m-item item m-mobile-hide"><i class="clone outline icon"></i>分类管理</a>
        <a href="#" th:href="@{/admin/friendlinks}" class="m-item item m-mobile-hide"><i class="pencil alternate icon"></i>友链管理</a>
        <a href="#" th:href="@{/admin/images}" class="m-item active item m-mobile-hide"><i class="images icon"></i>图片管理</a>
        <div class="right m-item m-mobile-hide menu">
          <div class="ui dropdown  item">
            <div class="text">
              <img class="ui avatar image" src="../../static/images/me.jpg" th:src="@{/images/me.jpg}">
              <span th:text="${session.user.nickname}">suoyue_zhan</span>
            </div>
            <i class="dropdown icon"></i>
            <div class="menu">
              <a href="" th:href="@{/admin/logout}" class="item">注销</a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </nav>
  <div class="m-padded-tb-hugex">
    <div class="ui attached pointing menu">
      <div class="ui container">
        <div class="right menu">
          <a href="#" th:href="@{/admin/images/input}" class=" item">发布</a>
          <a href="#" th:href="@{/admin/images}" class="teal active item">列表</a>
        </div>
      </div>
    </div>
  </div>

<br>
<br>

  <!--中间内容-->
  <div  class="m-padded-tb-mini">
    <div class="ui container">
      <div class="ui success message" th:unless="${#strings.isEmpty(message)}">
        <i class="close icon"></i>
        <div class="header">提示：<span th:text="${message}" style="color: #FF0000">三思后行-有始有终</span></div>
      </div>
      <table class="ui compact teal table">
        <thead>
          <tr align="center">
            <th>ID</th>
            <th>URL</th>
            <th>图片</th>
            <th>图片类型</th>
            <th>上传时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr align="center" th:each="image: ${imageList}">
            <td th:text="${image.id}">1</td>
            <td><a href="#" th:href="${image.url}"><span th:text="${image.url}"></span></a></td>
            <td><img src="../../static/images/wechat.jpg" th:src="${image.url}"  class="ui rounded image" alt="" style="width: 60px;height: 40px"></td>
            <td th:text="${image.valid}==true ? '1' : '0-文章图片' ">0/1</td>
            <td th:text="${#dates.format(image.createTime,'yyyy-MM-dd HH:mm:ss')}">图片创建时间</td>
            <td>
              <a href="#" th:href="@{/admin/imageUpdate/{id}(id=${image.id})}" class="ui mini teal basic button">编辑</a>
              <a href="#" th:href="@{/admin/imageDelete/{id}(id=${image.id})}" onclick="return confirm('确定要删除该图片吗？三思啊! 删了可就没了！')" class="ui mini red basic button">删除</a>
            </td>
          </tr>
        </tbody>

        <tfoot>
          <tr>
            <th colspan="6" >
              <div class="ui inverted divided stackable grid">
                <div class="three wide column" align="center">
                  <a th:href="@{/admin/images(pageNum=${imageList.pageNum}-1)}" class="item">上一页</a>
                </div>

                <div class="ten wide column" align="center">
                  <p>第 <span th:text="${imageList.pageNum}"></span> 页，共 <span th:text="${imageList.pages}"></span> 页，有 <span th:text="${imageList.total}"></span> 张图片</p>
                </div>

                <div class="three wide column" align="center">
                  <a th:href="@{/admin/images(pageNum=${imageList.pageNum}+1)}" class="item">下一页</a>
                </div>
              </div>
              <div align="center">
              <a href="#" th:href="@{/admin/images/input}">
                <button type="button" class="ui teal button m-mobile-wide m-margin-top"><i class="pencil icon"></i>新增</button>
              </a>
              </div>
            </th>
          </tr>
        </tfoot>
      </table>
    </div>
  </div>

  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>
  <br>


  <!--底部栏-->
  <footer class="ui inverted vertical segment m-padded-tb-massive m-opacity" th:replace="_fragments :: footer">
  </footer>

  <script src="../../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
  <script src="../../static/lib/Semantic-UI/semantic.min.js" th:src="@{/lib/Semantic-UI/semantic.min.js}"></script>

  <script>

    $('.menu.toggle').click(function () {
      $('.m-item').toggleClass('m-mobile-hide');
    });

    $('.ui.dropdown').dropdown({
      on : 'hover'
    });

    //消息提示关闭初始化
    $('.message .close')
      .on('click', function () {
        $(this)
          .closest('.message')
          .transition('fade');
      });

  </script>
</body>
</html>